<template>
  <div id="loanDetail">
    <div class="homeTitle">债券详情</div>
    <div class="tableBox">
      <div class="table">
        <!-- -------------------------------------------------------- -->
        <div class="tableTitle">申请人信息</div>
        <table>
          <tr>
            <td>机构编号</td> <td>{{user.no}}</td>
            <td>机构名称</td> <td>{{user.bank}}</td>
          </tr>
          <tr>
            <td>操作员工号</td> <td>{{user.jobNum}}</td>
            <td>操作员姓名</td> <td>{{user.name}}</td>
          </tr>
        </table>
        <!-- ------------------------------------------------- -->
        <div class="tableTitle">交易对手：</div>
        <table>
          <tr>
            <td>交易对手</td> <td>{{counterparty.full}}</td>
            <td>交易机构类型</td> <td>{{counterparty.type}}</td>
          </tr>
          <tr>
            <td>业务类型</td> <td>{{account.type}}</td>
            <td>开户行</td> <td>{{account.openBank}}</td>
          </tr>
          <tr>
            <td>账户名称</td> <td>{{account.accountName}}</td>
            <td>账号</td> <td>{{account.number}}</td>
          </tr>
          <tr>
            <td>支付系统行号</td> <td>{{account.payment}}</td>
            <td>托管机构</td> <td>{{account.trusteeship}}</td>
          </tr>
          <tr>
            <td>托管账户名称</td> <td>{{account.trusteeshipAccountName}}</td>
            <td>托管账号</td> <td>{{account.managedAccount}}</td>
          </tr>
        </table>
        <!-- ---------------------------------------------- -->
         <div class="tableTitle">成交信息：</div>
        <table>
          <tr>
            <td>申请编号</td> <td>{{hold.applyNo}}</td>
            <td>申请日期</td> <td>{{hold.applyDate | dateformat}}</td>
          </tr>
          <tr>
            <td>成交日期</td> <td>{{hold.transactionDate | dateformat}}</td>
            <td>成交编号</td> <td>{{hold.transactionNo}}</td>
          </tr>
          <tr>
            <td>借贷方向</td> <td>{{hold.direction}}</td>
            <td>清算速度</td> <td>{{hold.clearSpeed}}</td>
          </tr>
        </table>
 <!-- -------------------------------------------------------- -->
        <div class="tableTitle">交易信息：</div>
        <table>
          <tr>
            <td>标的债券代码</td> <td>{{hold.underlyingBondCode}}</td>
            <td>标的债券名称</td> <td>{{hold.underlyingBondName}}</td>
          </tr>
          <tr>
            <td>质押债券置换安排</td> <td>{{hold.bondReplacement}}</td>
            <td>借贷期限(天)</td> <td>{{hold.lendLimit}}</td>
          </tr>
          <tr>
            <td>标的债券券面总额（万元）</td> <td>{{hold.bondTotal}}</td>
            <td>计息基础</td> <td>{{hold.interestBase}}</td>
          </tr>
          <tr>
            <td>借贷费率（%）</td> <td>{{hold.lendRate}}</td>
            <td>借贷费用(元)</td> <td>{{hold.lendCost}}</td>
          </tr>
          <tr>
            <td>争议解决方式</td> <td>{{hold.disputeResolution}}</td>
            <td>交易品种</td> <td>{{hold.transactionType}}</td>
          </tr>
          <tr>
            <td>首次结算日</td> <td>{{hold.firstSettlementDate | dateformat}}</td>
            <td>到期结算日</td> <td>{{hold.dueDate | dateformat}}</td>
          </tr>
          <tr>
            <td>实际占券天数(天)</td> <td>{{hold.firstSettlementMethod}}</td>
            <td>首次结算方式</td> <td>{{hold.firstSettlementMethod}}</td>
          </tr>
          <tr>
            <td>到期结算方式</td> <td>{{hold.dueMethod}}</td>
            <td></td>
            <td></td>
          </tr>
        </table>
        <div class="tableTitle">质押品列表：</div>
        <table class="stable">
          <tr>
            <td>债券代码</td> <td>债券全称</td>
            <td>债券简称</td> <td>债券品种</td>
            <td>质押券面总额(万元)</td> 
          </tr>
          <tr v-for="(item, index) in pledges" :key="index">
            <td>{{item.code}}</td> <td>{{item.fullName}}</td>
            <td>{{item.simpleName}}</td> <td>{{item.variety}}</td>
            <td>{{item.sumMoney}}</td> 
          </tr>
        </table>
      </div>
      <div class="btn">
        <el-button type="primary" size="small" @click="close">关闭</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'loanDetail',
  data () {
    return {
      account: '',
      counterparty: '',
      hold: '',
      pledges: [],
      user: ''
    };
  },
  created () {
    this.getdata();
  },
  methods: {
    getdata() {
      this.axios.get('bondFinanceTransactionHold/selectOne',{params: {id: this.$route.query.id-0}})
        .then(({data})=> {
          // 此处数据明天待调整
          this.account = data.data.account;
          this.counterparty = data.data.counterparty;
          this.hold = data.data.hold;
          this.pledges = data.data.pledges;
          this.user = data.data.user;
        })
    },
    close () {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="scss">
  #loanDetail {
    .tableBox {
      padding-top: 10;
      color: white;
      .tableTitle {
        line-height: 36px;
        padding-left: 20px;
      }
      table {
        border: 1px solid white;
        width: 100%;
        text-align: center;
        border-collapse:collapse;
        margin-bottom: 20px;
        tr {
          td {
            padding: 5px 10px;
            border-right: 1px solid white;
            border-bottom: 1px solid white;
            &:nth-child(odd) {
              background:#2F3638;
            }
            &:nth-child(even) {
              background: #646E6E;
            }
          }
        }
      }
      .btn {
        text-align: center;
      }
    }
    .stable {
      border: 1px solid white;
      width: 100%;
      border-collapse: collapse;
        tr {
          &:first-child {
            background-color: #181C1D !important;;
            color: white;
            td {
              background-color: #181C1D !important;
            }
          }
          td {
            text-align: center;
            padding: 5px 10px;
            border-right: 1px solid white;
            border-bottom: 1px solid white;
            color: white;
            background: #2C3135;
          }
      }
    }
  }
</style>
